Skip to content

[google_maps_flutter] Support map UI control options and fix map event bugs - #1213

Open
seungsoo47 wants to merge 9 commits into
flutter-tizen:mainfrom
seungsoo47:upstream-plugins-google-maps-control-options
Open

seungsoo47 wants to merge 9 commits into
flutter-tizen:mainfrom
seungsoo47:upstream-plugins-google-maps-control-options

Conversation

@seungsoo47

Copy link
Copy Markdown
Contributor

Adds support for the remaining web map options and ports several fixes from google_maps_flutter_web.

  • Support mapTypeControlEnabled, fullscreenControlEnabled, streetViewControlEnabled, webCameraControlEnabled,
    webCameraControlPosition, webGestureHandling, and fortyFiveDegreeImageryEnabled.
  • Fix consumeTapEvents for circles, polygons, and polylines.
  • Fix initial map objects being added to the map twice.
  • Fix onMapCreated never being called when a map tile request stalls or fails. [google_maps_flutter_web] Don't hang onMapCreated when tiles fail to load flutter/packages#13059
  • Fix map events being dropped when the reported coordinates are integers.
  • Fix cluster managers passed to the initial GoogleMap being ignored.
  • Fix Cluster.markerIds holding internal ids instead of the markers' MarkerIds.
  • Fix a type cast error logged by getZoomLevel while the map is being disposed.

Implement mapTypeControlEnabled, fullscreenControlEnabled and
streetViewControlEnabled (google_maps_flutter_platform_interface 2.16.0,
flutter/packages#12191) and webCameraControlEnabled
and webCameraControlPosition (platform interface 2.14.0), following
google_maps_flutter_web 0.6.3.

Previously the three controls were always off and the camera control
options were ignored. updateMapConfiguration is overridden because the
default implementation serializes the configuration without these options,
so changes after the map was created were dropped.
…mageryEnabled

Implement the gesture handling and tilt control options added in
google_maps_flutter_platform_interface 2.4.0, following
google_maps_flutter_web 0.6.4+1 (_configurationAndStyleToGmapsOptions):
webGestureHandling sets gestureHandling, falling back to the existing
none/auto behavior when unset, and fortyFiveDegreeImageryEnabled sets
rotateControl.
… polylines

Circles, polygons, and polylines were created without the clickable
option, so the JS map made them clickable by default. A shape with
consumeTapEvents: false still swallowed taps and GoogleMap.onTap was
never called for taps on it.

Set clickable from consumeTapEvents, as google_maps_flutter_web does.

Upstream: flutter/packages#9838 (7ace630a87d6,
google_maps_flutter_web 0.5.13)
GoogleMapsController.init() is called eagerly by buildView and again by
GoogleMapsPlugin.init(). The second call skipped map creation but
rendered the initial markers, circles, polygons, polylines, ground
overlays, and marker clusterers again. The second set replaced the first
in the controllers, so the first set stayed on the map for good:
removing an initial circle left a copy of it behind.

Run the initialization once and let later calls wait for it.
google_maps_flutter_web avoids the same problem by leaving
GoogleMapsPlugin.init() empty.
The map was reported as ready only on the first `tilesloaded` event,
which requires every visible tile to finish downloading. A single
stalled or failed tile request left `onMapCreated` pending forever.

Also report the map as ready on the first `idle` event once the map
div has a non-zero size, as google_maps_flutter_web does.

Upstream: flutter/packages#13059
(google_maps_flutter_web 0.6.4+2, flutter/flutter#193452)
…ropped

Coordinates sent from the JavaScript side are decoded with json.decode,
which yields an int for a whole number such as 3 or -20. The handlers
cast them with `as double`, so a tap, long press, marker drag, or
cluster tap at such a position threw a cast error that was only logged,
and the event was never delivered. The visible region had the same
cast.

Convert the decoded numbers through `num`, as _convertToLatLng already
does.
buildViewWithConfiguration did not pass mapObjects.clusterManagers to
GoogleMapsController, so the cluster managers given to the initial
GoogleMap were never created: their markers were drawn one by one and
onClusterTap never fired. The controller also added the initial markers
before the cluster managers, so even a passed-in cluster manager would
not have received its initial markers.

Pass the cluster managers through and create them before the initial
geometry, as google_maps_flutter_web does.

Upstream reference: google_maps_flutter_web GoogleMapController
(clusterManagers from mapObjects, _initClustering before
_renderInitialGeometry).
The cluster click event carries the `id` property of each JS marker,
which is the internal GMarker counter, and _convertCluster turned it
into MarkerId('0'), MarkerId('1') and so on. onClusterTap therefore
reported marker ids that the app never created.

Map the internal ids back to the markers' MarkerIds through
MarkersController, as the marker click and drag handlers already do.
google_maps_flutter_web builds Cluster.markerIds from the MarkerId
stored on each marker (getMarkerId).
A `bounds_changed` event still being handled when the map is disposed
calls `getZoom` on a webview that is being torn down, which returns ''
instead of a number. The `as num` cast then threw and logged
"type 'String' is not a subtype of type 'num'".

Return 0.0 for non-numeric results instead of casting.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T08:45:55.101364Z 021d76d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@JSUYA JSUYA left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks that the example is out of sync with the upstream version.
Synchronizing the example should enable testing for some additional features.

Comment on lines +107 to +109
'mapTypeControl: ${rawOptions['mapTypeControlEnabled'] ?? false}'
', fullscreenControl: ${rawOptions['fullscreenControlEnabled'] ?? false}'
', streetViewControl: ${rawOptions['streetViewControlEnabled'] ?? false}';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these controls actually rendered on the screen and available for testing?
In my local test environment, the option values ​​are being passed to the Maps JS, but I am unable to see the controls themselves rendered on the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants